
<{include file="www/header.tpl"}>
<{include file="www/header-base.tpl"}>

<div class="base-banner-wrap-scen" style="background:url('<{$scenic.cover}>') 0px 0px no-repeat;background-size:cover;">
</div>

<h1 class="scen-de-title"><{$scenic.name}><span class="span">（<{$scenic.subTitle}>）</span></h1>

<h2 class="scen-de-stitle">
    景点介绍
    <span class="xian"></span>
</h2>

<div class="scen-de-text">
    <p class="hang"><{$scenic.summary}></p>
</div>

<h2 class="scen-de-stitle">
    景点图片
    <span class="xian"></span>
</h2>

<ul class="scen-de-img fix">
    <{foreach from=$scenic.images item=v }>
    <li class="li">
        <img src="<{$v}>" class="img">
    </li>
    <{/foreach}>
</ul>

<h2 class="scen-de-stitle">
    景点地址
    <span class="xian"></span>
</h2>

<p class="scen-de-did"><{$scenic.address}></p>

<div class="scen-de-map-wrap">

    <div id="map_canvas" style="width:1000px; height:300px;"></div>

</div>

<h2 class="scen-de-stitle">
    景点官网
    <span class="xian"></span>
</h2>


<p class="scen-de-wang"><{$scenic.website}></p>

<h2 class="scen-de-stitle">
    实用信息
    <span class="xian"></span>
</h2>

<div class="scen-de-shiy">
    <p class="title time">开放时间</p>
    <p class="info"><{if $scenic.descOpenTime == "" }>暂无<{else}><{$scenic.descOpenTime}><{/if}></p>
    <p class="info last-child"> </p>
    <p class="title piaow">票务信息</p>
    <p class="info"><{if $scenic.descTickets == "" }>暂无<{else}><{$scenic.descTickets}><{/if}></p>
</div>

<h2 class="scen-de-stitle">
    评价
    <span class="xian"></span>
</h2>

<ul class="scen-de-comm" id="comments_list">
</ul>

<div class="scen-de-get">
    <a href="/comments/more_comments/2?action=scenicspot&tid=<{$scenic.id}>" next="2" onclick="return false" id="get_more" class="a">查看更多评价</a>
</div>

<form method="post" action="/comments/create" class="scen-de-form" id="comments">
    <textarea class="textarea" id="comments_text" name="comments" placeholder="请输入你的评论"></textarea>
    <input type="hidden" name="action" value="scenicspot"/>
    <input type="hidden" name="uid" value="<{$uid}>"/>
    <input type="hidden" name="tid" value="<{$scenic.id}>"/>
    <div class="bottom fix">

        <{if $global_user.userUid > 0}>
        <input type="button" value="提交评论" onclick="commit_form()" class="right">
        <{else}>
        <p class="left">
            <a href="javascript:;" class="a" onclick="showBox($('.login-wrap'), $('.alert-bg')); $('body,html').animate({scrollTop:0},0);">登陆</a>参与评论
        </p>
        <{/if}>
    </div>

</form>

<script>
    $(function() {
        var more = $("#get_more");
        more.click(function(){
            var url = more.attr("href");
            $.ajax({
                type : "get",
                url : url,
                data : $('#comments').serialize(),
                success : function(response) {
//                        console.log(response);
                    if(response){
                        $("#comments_list").append(response);
                        var next = more.attr('next');
                        var next_url = '/comments/more_comments/'+(++next)+'?action=scenicspot&tid='+<{$scenic.id}>;
                        more.attr('href',next_url);
                        more.attr('next',next);
                        console.log(next_url);
                    }else{
                        more.hide();
//                        $("#no_nore").show();
                    }
//                    console.log(response)

                }
            });
        });
    });
    function commit_form(){
//        console.log($('#comments').serialize());
        var comments_text = $('#comments_text').val();
        if(comments_text == ""){
            layer.msg("请输入您的评论");
            return false;
        }

        $.ajax({
            type : "post",
            url : "/comments/create",
            data : $('#comments').serialize(),
            success : function(response) {
                var data2 = $.parseJSON(response);
                layer.msg(data2.msg);
                loadComments();
                $("#comments_text").val("");
            }
        });
//        $("#comments").submit();

    }
    loadComments();
    function loadComments(){
        var url = "/comments/get_comments"+"?action=scenicspot"+"&tid="+<{$scenic.id}>;
        $.ajax({
            type : "get",
            url : url,
            success : function(response) {

                if(response == ""){
                    $("#get_more").hide();
                }else{
                    $("#comments_list").html(response);
                }
//                console.log(response);
            }
        });
    }
</script>
<script type="text/javascript"
        src="http://maps.google.cn/maps/api/js?key=AIzaSyCXDeoGjdaJoF22xDyU0L-cugypMDjxQJY">
</script>
<script type="text/javascript">
    var myplace,infowindow,marker;
    var myLatlng=new google.maps.LatLng(<{$scenic.lat}>,<{$scenic.lng}>);
    var mapOptions = {
        center: myLatlng,
        zoom: 13,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
            mapOptions);

    $(document).ready(function(){
        marker = new google.maps.Marker({
            map: map,
            position: myLatlng
        });
        infowindow = new google.maps.InfoWindow({
            content:"<{$scenic.name}>",
            maxWidth: 300
        });
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map,marker);
        });
    });

</script>
<{include file="www/comments/index.tpl"}>
<{include file="www/footer.tpl"}>
